home *** CD-ROM | disk | FTP | other *** search
- /*
- * PubScreenFont.c -- tell font used by a [named] public screen
- *
- * Michael Groshart -- Island Earth Software
- */
-
- static char version[] = "$VER: PubScreenFont 1.1 (5.12.93)";
-
- #include <clib/dos_protos.h>
- #include <clib/exec_protos.h>
- #include <clib/graphics_protos.h>
- #include <clib/intuition_protos.h>
-
- #include <pragmas/dos_lib.h>
- #include <pragmas/exec_lib.h>
- #include <pragmas/graphics_lib.h>
- #include <pragmas/intuition_lib.h>
-
- #ifdef AZTEC_C
- void _wb_parse(void) {}
- void _cli_parse(void) {}
- #endif
-
- /*
- * print value(s) of font bits
- */
-
- struct FontBits
- {
- UBYTE value,*text;
- }
- style[] =
- {
- { FSF_UNDERLINED ," underlined" },
- { FSF_BOLD ," bold" },
- { FSF_ITALIC ," italic" },
- { FSF_EXTENDED ," extended" },
- { FSF_COLORFONT ," colorfont" },
- },
- flags[] =
- {
- { FPF_REVPATH ," revpath" },
- { FPF_TALLDOT ," talldot" },
- { FPF_WIDEDOT ," widedot" },
- { FPF_PROPORTIONAL," proportional" },
- { FPF_DESIGNED ," designed" },
- };
-
- void lookup(struct FontBits *table,UBYTE mask)
- {
- WORD i;
-
- for (i = 0 ; i < 5 ; ++i)
- {
- if (table[i].value & mask)
- {
- PutStr(table[i].text);
- }
- }
- }
-
- /*
- * entry point, pretty simple really
- */
-
- long args[1],rc = RETURN_ERROR; /* presume failure */
-
- main(void)
- {
- struct Library *IntuitionBase;
- struct RDArgs *rda;
- struct Screen *screen;
- struct TextFont *font;
-
- if (IntuitionBase = OpenLibrary("intuition.library",36L))
- {
- if (rda = ReadArgs("PUBSCREEN",args,NULL))
- {
- if (screen = LockPubScreen((char *) args[0]))
- {
- rc = RETURN_OK;
- font = screen->RastPort.Font;
-
- Printf("%s %d %d",font->tf_Message.mn_Node.ln_Name,font->tf_YSize,font->tf_XSize);
-
- lookup(style,font->tf_Style);
- lookup(flags,font->tf_Flags);
-
- PutStr("\n");
-
- UnlockPubScreen(NULL,screen);
- }
- FreeArgs(rda);
- }
- CloseLibrary(IntuitionBase);
- }
- return rc;
- }
-